const api = require('../utils/request.js')

module.exports = {
  // 获取营地列表
  campList(query) {
    return api.requests(
      '/wechat/camp/list',
      'get',
      query
    )
  },
  //营地信息添加
  campAddInfo(params) {
    return api.request(
      '/wechat/camp',
      'post',
      {
        "address":params.address,
        "campName":params.campName,
        "campType":params.campType,
        "imageUrl":params.campImgs.join(","),
        "introduce":params.introduce,
        "latitude":params.latitude,
        "location":params.location,
        "longitude":params.longitude,
        "linkman":params.linkman,
        "phone":params.phone,
        "specificTime":params.timeType,
        "userId":params.userId,
        "userType":params.userType
      }
    )
  },
    //营地信息修改
    campUpInfo(params) {
      return api.request(
        '/wechat/camp',
        'put',
        {
          "campId":"2e72e788-fc9b-4065-9820-0347116e7a7f",
          "address":params.address,
          "campName":params.campName,
          "campType":params.campType,
          "imageUrl":params.imageUrl.join(","),
          "introduce":params.introduce,
          "latitude":params.latitude,
          "location":params.location,
          "longitude":params.longitude,
          "linkman":params.linkman,
          "phone":params.phone,
          "specificTime":params.timeType,
          "userId":params.userId,
          "userType":params.userType
        }
      )
    },
    //游客营地信息添加
    touristAddInfo(params) {
      return api.request(
        '/wechat/camp',
        'post',
        params
      )
    },
  //营地设施服务添加
  campAddFacilities(params) {
    return api.request(
      '/wechat/facility/add',
      'post',
      params
    )
  },
  //营地营位添加
  campAddCampsite(params) {
    return api.request(
      '/wechat/campsite',
      'post',
      params
    )
  },
  //营地营位删除
  campDelCampsite(campsiteId) {
    return api.request(
      '/wechat/campsite/'+campsiteId,
      'delete'
    )
  },
  //营地营位根据id获取 /wechat/campsite/list
  getCampCampsite(params) {

    return api.request(
      '/wechat/campsite/list',
      'GET',
      params
    )
  },
  //营地服务设施
  serviceFacilities() {
    return api.request(
      '/wechat/facility/list',
      'get',
    )
  },
  //获取营地服务设施选择数据
  getFacilitiesA(id){
    return api.request('/wechat/facility/getInfo/'+id,'get')
  },
  // 获取营地详情
  campDetail(campId){
    return api.request(
        `/wechat/camp/${campId}`,
        'get',
    )
  },
  
  // 删除营地
  deleteCamp(campId){
    return api.request(
      `/wechat/camp/${campId}`,
      'delete'
    )
  },
  // 收藏营地 与取消收藏
  collectCamp(data){
    return api.request(
      "/wechat/collect",
      "post",
      data
    )
  },
  // 收藏列表
  collectCampList(userId){
    return api.requests(
      "/wechat/collect/list",
      "get",
      {userId:userId}
    )
  },
  // 取消收藏营地
  removeCollectCamp(data){
    return api.request(
      "/wechat/collect",
      "post",
      data
    )
  },
  // 添加评论
  addComment:function(data){
    return api.request(
      "/wechat/evaluate",
      "post",
      data
    )
  },
  // 评论列表
  commentList:function(campId){
    return api.requests(
      '/wechat/evaluate/list',
      "get",
      {campId:campId}
    )
  },
  // 广告banner列表
  getBannerList:function(){
    return api.request(
        '/wechat/banner/list',
        'get'
    )
  },
  // 获取营位列表
  getCampsiteList:function(query){
    return api.requests(
      "/wechat/campsite/list",
      "get",
      query
    )
  }
}